<div class="row" style="border-bottom: 10px solid #EFEFEF;padding:10px;">
	<div class="col-lg-8">
		<div class="ukefu-measure">
			<div class="ukefu-bt"> 
				<div	class="layui-icon ukewo-btn ukefu-content-ind"><img src="/images/weixin.jpg" style="width:60px;height:60px;"></div>
				<div class="ukefu-bt-text">
					<div class="ukefu-bt-text-title"
						style="font-weight:400;font-size:24px;border-bottom:1px solid #dedede;">
							${snsAccount.name!''}
							<span style="font-size:15px;color:#AAAAAA;">公众号创建时间：${snsAccount.createtime!?string("yyyy-MM-dd HH:mm:ss")}</span>
					</div>
					<div class="ukefu-bt-text-content" style="">${snsAccount.name!''}</div>
				</div>
			</div>
		</div>
	</div>
	<div class="col-lg-4">
		<form class="layui-form" action="/admin/weixin/update.html"	method="post">
			<div class="layui-form-item">
				<label class="layui-form-label">
					人工坐席：
				</label>
				<div class="layui-input-block ukefu-agent-switch" style="padding-top:0px;">
					<input type="checkbox" name="switch" <#if snsAccount.agent?? && snsAccount.agent == true>checked</#if> lay-filter="agent" lay-skin="switch" value="1" lay-text="开启|关闭">
				</div>
			</div>
		</form>
	</div>
</div>
<div class="row" style="border-bottom: 10px solid #EFEFEF;padding:10px;">
	<div class="col-lg-12">
		<span style="font-weight:600;">接口地址：</span>${schema!''}://${hostname!''}<#if port?? && port != '80'>:${port?string('###')}</#if>/im/weixin/${snsAccount.snsid!''}
		<span style="font-weight:600;margin-left:50px;">Token：</span>${snsAccount.token!''}
		<span style="font-weight:600;margin-left:50px;">AppID：</span>${snsAccount.appkey!''}	
	</div>
</div>
<div class="ukefu-tab-title" style="margin-left: 0px;">
	<#include "/admin/channel/weixin/include/top.html">
</div>

<div class="row">
	<div class="col-lg-12" style="padding: 10px;">

		<div class="row">
			<a type="button" class="layui-btn  layui-btn-sm " href="/admin/weixin/menu/add.html?id=${snsAccount.id!''}" >新增菜单</a>
			<a type="button" class="layui-btn  layui-btn-sm " href="/admin/weixin/menu/valid.html?id=${snsAccount.id!''}">验证菜单</a>
			<a type="button" class="layui-btn  layui-btn-sm " data-toggle="tip" title="确定同步到微信公众号吗？"  href="/admin/weixin/menu/post.html?id=${snsAccount.id!''}">同步到微信公众号</a>

		</div>
		<div class="row" style="margin-top: 10px;">
			<table class="layui-table layui-form" id="tree-table" lay-size="sm"></table>
		</div>
	</div>
</div>

<script>
    layui.config({
        base: '/lay/modules/',
    })
    layui.use(['treeTable','layer','code','form'],function(){
        var o = layui.$,
            form = layui.form,
            layer = layui.layer,
            treeTable = layui.treeTable;

    <#if msg?? &&  msg =="exist_sub">
        layer.alert('该菜单存在下级菜单，不能删除！请先删除子菜单！', {icon: 2});
		<#elseif  msg?? &&  msg =="menu_num_err" >
        layer.alert('自定义菜单最多包括3个一级菜单，每个一级菜单最多包含5个二级菜单', {icon: 2});
	<#elseif  msg?? &&  msg =="menu_type_empty" >
		layer.alert('一级菜单，不含二级菜单时，菜单类型必填', {icon: 2});
    <#elseif  msg?? &&  msg =="valid_success" >
        layer.alert('初步验证通过', {icon: 1});
    <#elseif  msg?? &&  msg =="post_err" >
        layer.alert('同步到微信公众号失败', {icon: 2});
    <#elseif  msg?? &&  msg =="post_success" >
        layer.alert('同步到微信公众号成功', {icon: 1});
    <#elseif  msg??>
        layer.alert('${msg}', {icon: 2});
    </#if>
        var tableDate = [
            <#if parentList?? && parentList?size gt 0>
			<#list parentList as m>
		{"id":'${m.id!''}',"parentid":'${m.parentid}',"name":'${m.name}',"type":'<#if m.type??>${menuButtonType[m.type]}</#if>'},
			</#list>
        </#if>
		];

        var	re = treeTable.render({
            elem: '#tree-table',
            data:tableDate,
			icon_key: 'title',
            primary_key: 'id',
            parent_key: 'parentid',
            end: function(e){
                form.render();
            },
            cols: [
                {
                    key: 'title',
                    title: '菜单名称',
                    width: '200px',
                    template: function(item){
                        if(item.level == 0){
                            return '<span style="color:red;">'+item.name+'</span>';
                        }else if(item.level == 1){
                            return '<span style="color:green;">'+item.name+'</span>';
                        }else if(item.level == 2){
                            return '<span style="color:#aaa;">'+item.name+'</span>';
                        }
                    }
                },
                {
                    key: 'type',
                    title: '类型',
                    align: 'center',
                },
                {
                    title: '操作',
                    align: 'center',
                    template: function(item){
                        return '<a  href="/admin/weixin/menu/edit.html?id='+item.id+'">编辑</a> | <a  data-toggle="tip" title="确定删除吗？注意要先删除子菜单" href="/admin/weixin/menu/delete.html?id='+item.id+'">删除</a>';
                    }
                }
            ]
        });

    })
</script>